<div class="row">
  <div id="summaryPanel" class="panel panel-default">
    <div class="panel-heading panel-title" data-toggle="collapse" data-target="#summaryTable">
      Summary <span class="glyphicon glyphicon-menu-up"></span>
    </div>
    <% data_symbols = [:features, :scenarios, :step_definitions, :hooks] %>
    <table id="summaryTable" class="table table-responsive table-striped collapse in">
      <tr>
        <td></td>
        <td>
          <span class="full-page">Features</span>
          <span class="small-page" title="Features">F</span>
        </td>
        <td>
          <span class="full-page">Scenarios</span>
          <span class="small-page" title="Scenarios">S</span>
        </td>
        <td>
          <span class="full-page">Step Definitions</span>
          <span class="small-page" title="Step Definitions">S.D.</span>
        </td>
        <td>
          <span class="full-page">Hooks</span>
          <span class="small-page" title="Hooks">H</span>
        </td>
      </tr>
      <tr>
        <td>
          Total Score
          <span title="Total Points for a section." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td>
              <%= cuke_sniffer.summary[symbol][:total_score] %>
            </td>
        <% end %>
      </tr>
      <tr>
        <td>
          Count
          <span title="Total Number of objects found in the project." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td><%= cuke_sniffer.summary[symbol][:total].inspect %></td>
        <% end %>
      </tr>
      <tr>
        <td>
          Lowest Score
          <span title="Score of the best object found." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td><%= cuke_sniffer.summary[symbol][:min] %></td>
        <% end %>
      </tr>
      <tr>
        <td>
          Highest Score
          <span title="Score of the object with the most to improve on." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td><%= cuke_sniffer.summary[symbol][:max] %></td>
        <% end %>
      </tr>
      <tr>
        <td>
          Average Score
          <span title="Average score of a section." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td>
              <% if cuke_sniffer.summary[symbol][:average].nan?%>
                  0
              <% else %>
                  <%= cuke_sniffer.summary[symbol][:average] %>
              <% end %>
            </td>
        <% end %>
      </tr>
      <tr>
        <td>
          Threshold
          <span title="The maximum score an object can have to be considered good." class="glyphicon glyphicon-question-sign"
                data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td><%= cuke_sniffer.summary[symbol][:threshold] %></td>
        <% end %>
      </tr>
      <tr>
        <td>
          Good
          <span title="Percentage of the objects that can be considered good in the project."
                class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td>
              <% if cuke_sniffer.summary[symbol][:good] == 0 %>
                0
              <% else %>
                <%= ((cuke_sniffer.summary[symbol][:good].to_f/cuke_sniffer.summary[symbol][:total].to_f) * 100).round(2) %>
              <% end %>
              %
            </td>
        <% end %>
      </tr>
      <tr>
        <td>
          Bad
          <span title="Percentage of the objects that can be considered bad in the project."
                class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="right"></span>
        </td>
        <% data_symbols.each do |symbol| %>
            <td>
              <% if cuke_sniffer.summary[symbol][:bad] == 0 %>
                  0
              <% else %>
                  <%= ((cuke_sniffer.summary[symbol][:bad].to_f/cuke_sniffer.summary[symbol][:total].to_f) * 100).round(2) %>
              <% end %>
              %
            </td>
        <% end %>
      </tr>
    </table>
  </div>
</div>